<template>
  <div>
    登录<br>
    <div style="color: red">{{errorInfo}}</div>
    用户名：<el-input v-model="userObj.userName" style="width: 200px"></el-input><br>
    密码：<el-input v-model="userObj.pwd" type="password" style="width: 200px"></el-input><br>
    <el-button type="primary" @click="land">登录</el-button>
  </div>
</template>

<script>
import axios from "axios"
export default {
  data() {
    return {
      errorInfo:"",
      userObj:{},
    }
  },
  methods:{
    land(){
      axios.get("/project/user/login",{params:this.userObj}).then(resp =>{
        var info = resp.data;
        if (info == ""){
          this.errorInfo="登录失败";
        }else {
          sessionStorage.setItem("loginUser",JSON.stringify(info));
          this.$router.push("/index")
        }
      });
    }
  }
}
</script>

<style scoped>

</style>